package com.leetcode.partition5;

import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2021/10/20 9:06
 */
public class LC453最小操作次数使数组元素相等 {

    public static int minMoves(int[] nums) {
        int minValue = Arrays.stream(nums).min().getAsInt();
        int answer = 0;
        for (int num : nums) {
            answer += num - minValue;
        }
        return answer;
    }
}
